package com.company.jrlz.service;

import com.company.jrlz.entity.ZKPLCSignal;
import com.haulmont.cuba.security.app.Authentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.inject.Inject;

@Service(UaItemListenerService.NAME)
public class UaItemListenerServiceBean implements UaItemListenerService {

    public static final Logger LOGGER = LoggerFactory.getLogger(UaItemListenerServiceBean.class);

    @Inject
    private Authentication authentication;

    @Inject
    private PlcService plcService;

    @Override
    public void handlePlcItem(String node, String nodeValue) {

        authentication.begin();
        LOGGER.info("----------lcy接收到：" + node + "," + nodeValue);
        switch (node){
            case ZKPLCSignal.n0101ReceiveFM:
                plcService.n0101(node, nodeValue);
                break;

            default:
                return;
        }
        authentication.end();
    }

}